package com.android.aircondition.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

import com.android.aircondition.R;
import com.android.aircondition.common.TimerListAdapter;

public class TimerActivity extends BaseActivity{
	
	
  /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.timer);
        setCommonTitle(this, R.string.title_timer);
        
    }
    
   	protected void onResume() {
   		super.onResume();
   		setViews();
   	}

    private void setViews(){
    	ListView timerListView = (ListView)findViewById(R.id.timerListView);
    	TimerListAdapter adapter = new TimerListAdapter(this);
    	timerListView.setAdapter(adapter);
    	
    	timerListView.setOnItemClickListener(new OnItemClickListener() {
    		
    		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    		
    			Intent intent = new Intent(TimerActivity.this,TimerEditActivity.class);
    			intent.putExtra("edit", position);
    			startActivity(intent);
    		}
		});
    }
}
